<?php
class Accountlog extends CS_Controller
{
    function _init()
    {
        $this->load->library('pagination');
        $this->load->model('account_log_model', 'accountLog');
    }
    
    public function index($pg = 1)
    {
        $num = ($pg-1)*20;
        $config['base_url'] = base_url('accountlog/index');
        $config['total_rows'] = $this->accountlog->total();
        $config['uri_segment'] = 3;
        $this->pagination->initialize($config);
        $data['pg_link'] = $this->pagination->create_links();
        $data['line_list'] = $this->accountlog->page_list($num);
        $data['all_rows'] = $config['total_rows'];
        $data['pg_now'] = $pg;
        $this->load->view('accountlog/index', $data);
    }
    
    public function search($pg = 1)
    {
        if (!$this->search_get_validate($this->input->get())) {
            $this->redirect('accountlog/index');
        }
        $data['title']        = $this->input->get('title');
        $data['source_state'] = $this->input->get('source_state');
        $getData = $data;
    
        $num = ($pg-1)*20;
        $config['first_url'] = base_url('advert/search').$this->pageGetParam($this->input->get());
        $config['suffix'] = $this->pageGetParam($this->input->get());
        $config['base_url']    = base_url('advert/search');
        $config['total_rows']  = $this->advert->search_total($getData);
        $config['uri_segment'] = 3;
        $this->pagination->initialize($config);
        $data['pg_link']   = $this->pagination->create_links();
        $data['line_list'] = $this->advert->search_page_list($num, $getData);
        $data['all_rows']  = $config['total_rows'];
        $data['pg_now']    = $pg;
        $data['advertArray'] = $this->advertArray;
        $this->load->view('advert/grid', $data);
    }
}